import { CardsStruct } from "./CardsStruct";
import { IdiomData } from "./IdiomData";
import cnchar from 'cnchar';
import idiom from 'cnchar-idiom';
import explain from 'cnchar-explain';

export class CardsData {

    private static _ins: CardsData = null;
    public static get ins(): CardsData {
        if (CardsData._ins == null) {
            CardsData._ins = new CardsData();
        }
        return CardsData._ins;
    }

    /** 获得卡牌 */
    getCardOne(name: string, index: number) {
        let cardID = index;
        let tone_arr = cnchar.spell(name, "array","tone","low");
        let dec = "dec";
        return new CardsStruct(cardID, name, tone_arr, dec);
    }
    getCards() {
        let idioms = IdiomData.ins.getIdioms();
        if(!idiom) { return; }
        let cardsInfo = [];
        for (let index = 0; index < idioms.length; index++) {
            // let ret = this.getCardOne(idioms[index], index);
            
            cardsInfo[index] = this.getCardOne(idioms[index], index);
        }
        // console.log("cardsInfo: ", cardsInfo);
        return cardsInfo;
    }

}




